//
//  CalculatorButton.swift
//  Calculator
//
//  Created by zhaoke on 2023/6/10.
//

import Foundation
import SwiftUI

struct CalculatorButton: View {
    let fontSize: CGFloat = 38
    let title: String
    let size: CGSize
    let backgroundColor: Color
    let action: () -> Void
    
    var body: some View {
        Button(action: action) {
            Text(title)
                .font(.system(size: fontSize))
                .foregroundColor(.white)
                .frame(width: size.width, height: size.height)
                .background(backgroundColor)
                .cornerRadius(size.width / 2)
        }
//        ZStack() {
//            Capsule()
//                .fill(backgroundColor)
//                .frame(width: size.width, height: size.height)
//                .onTapGesture(perform: action)
//            Text(title)
//                .font(.system(size: fontSize))
//                .foregroundColor(.white)
//        }
    }
}
